<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import route from '@/api/routes/route'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'

const crudRef = ref()




const options = reactive({
  id: 'route',
  pk: 'id',
  pageLayout: 'fixed',
  formOption: {
    viewType: 'drawer',
    width: 600
  },
  api: route.getList,
})

const columns = reactive([
  {
    title: "主键",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入主键"
    }
  },
  {
    title: "类型",
    dataIndex: "route_type_id",
    formType: "select",
    search: true,
    dict: {
      url: 'routes/routeType/list', 
      props: { 
        label: 'name',
        value: 'id' 
      }, 
      translation: true
    },
    commonRules: {
      required: true,
      message: "请输入类型"
    }
  },
  {
    title: "时间",
    dataIndex: "time",
    formType: "date",
    search: true,
    showTime: true
  },
  {
    title: "关联id",
    dataIndex: "about_id",
    formType: "input",
    search: true,
    commonRules: {
      required: true,
      message: "请输入关联id"
    }
  },
  {
    title: "关联模型",
    dataIndex: "model",
    formType: "input",
    search: true,
    commonRules: {
      required: true,
      message: "请输入关联模型"
    }
  },
  {
    //   1  船   2  包裹  3  第三方   4  手动  5 系统
    title: "创建类型",
    dataIndex: "create_type",
    formType: "select",
    search: true,
    commonRules: {
      required: true,
      message: "请输入创建类型"
    }
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  }
])
</script>
<script> export default { name: 'routes:route' } </script>